<template>
	<view>
		<!-- 用户信息 -->
		<view style="margin-bottom: 30rpx;"><Base></Base></view>
		<!-- 我的宠物 -->
		<Mypet></Mypet>
		<view @click="logout()" class="logout">退出登录</view>
	</view>
</template>

<script lang="ts" setup>
	import {ref,reactive} from "vue"
	import {onShow} from "@dcloudio/uni-app"
	import Base from "./components/base.vue"
	import Mypet from "./components/mypet.vue"
	
	onShow(()=>{
		if(!getApp().globalData.istabbar){
			getApp().globalData.istabbar=true
			uni.setTabBarBadge({
				index:1,
				text:String(getApp().globalData.noreadnum)
			})
		}
	})
	if(!uni.getStorageSync('userinfo')){
		uni.navigateTo({
			url: "/pages/login/index"
		})
	}
	
	function logout(){
		uni.removeStorageSync('userinfo')
		uni.removeStorageSync('petlist')
		uni.redirectTo({
			url:'/pages/login/index'
		})
	}
</script>

<style lang="scss">
	.logout{
		color:#666;
		position: absolute;
		font-size: 28rpx;
		left: 50%;
		transform: translate(-50%);
		bottom: 80rpx;
	}
</style>
